--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit 314febee3a49ef8bbd2bfaeafdd80a6abd00fa83
Parents : 1ae7cea
Author : Mark Qvist <mark@unsigned.io>
Date : 2025-11-24T18:43:32+01:00
Added message size rendering limit to conversation view. Fixes #93.
Changes
Diff
diff --git a/sbapp/ui/messages.py b/sbapp/ui/messages.py
index acf82307..f32df782 100644
--- a/sbapp/ui/messages.py
+++ b/sbapp/ui/messages.py
@@ -49,6 +49,8 @@ if RNS.vendor.platformutils.is_darwin():
from kivy.lang.builder import Builder
from kivymd.uix.list import OneLineIconListItem, IconLeftWidget
+MSG_RENDER_LIMIT = 11000
+
class DialogItem(OneLineIconListItem):
divider = None
icon = StringProperty()
@@ -735,8 +737,11 @@ class Messages():
alstr = RNS.prettysize(len(audio_field[1]))
heading_str += f"\n[b]Audio Message[/b] ({alstr})"
+ final_content = pre_content+message_markup.decode("utf-8")+extra_content
+ if len(final_content) > MSG_RENDER_LIMIT:
+ final_content = pre_content+"[i]The content of this message is too large to display in the message stream. You can copy the message content into another program by using the context menu of this message, and selecting [b]Copy[/b].[/i]"+extra_content
item = ListLXMessageCard(
- text=pre_content+message_markup.decode("utf-8")+extra_content,
+ text=final_content,
heading=heading_str,
md_bg_color=msg_color,
)
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────